import handler from './index';
const reducer = (state = { ...handler.state },action:{type:string}) => {
    let newState = JSON.parse(JSON.stringify(state));
    // switch (action.type) {
    //     case handlernum.add:
    //         handlernum.actions[handlernum.add](newState, action);
    //     case handlernum.add2:
    //         handlernum.actions[handlernum.add2](newState, action);
    //     default:
    //         break;
    // }

    for(let key in handler.actionNames){
        if(handler.actionNames[key] === action.type){
            handler.actions[handler.actionNames[key]](newState,action);
            break;
        }
    }

    return newState
}

export default reducer